// const { default: axios } = require("axios")

async function getnewalbums() {
    const res = await axios({
        url: '/album/newest',
        method: 'GET'
    })
    return res
}

async function getAllAlbum(cat) {
    const res = await axios({
        url: `/top/album?area=${cat}`,
        method: 'GET'
    })
    return res
}

async function newdisc() {
    const res = await getnewalbums()
    const data = res.data.albums
    $('.hotdisc')[0].innerHTML = ''
    for (let i = 0; i < 10; i++) {
        $('.hotdisc')[0].innerHTML += `<li>
        <div class="new-img">
            <img src="${data[i].picUrl}?param=130y130" alt="">
            <a href="javascript:;"></a>
            <a class="hide" href="javascript:;"></a>
        </div>
        <p class="new-dec">
            <a class="f-thide" href="javascript:;">${data[i].name}</a>
        </p>
        <p class="f-thide">
            <a href="javascript:;">${data[i].artist.name}</a>
        </p>
    </li>`

    }
}
newdisc()


async function allAlbum(cat){
    const res = await getAllAlbum(cat)
    const data = res.data.monthData
    $('.hotdisc')[1].innerHTML = ''
    for (let i = 0; i < 35; i++) {
        $('.hotdisc')[1].innerHTML += `<li>
        <div class="new-img">
            <img src="${data[i].picUrl}?param=130y130" alt="">
            <a href="javascript:;"></a>
            <a class="hide" href="javascript:;"></a>
        </div>
        <p class="new-dec">
            <a class="f-thide" href="javascript:;">${data[i].name}</a>
        </p>
        <p class="f-thide">
            <a href="javascript:;">${data[i].artist.name}</a>
        </p>
    </li>`

    }
}

allAlbum('ALL')